package com.tiny_wind.tiny_wind_diary.service.impl;


import com.tiny_wind.tiny_wind_diary.dao.UserDao;
import com.tiny_wind.tiny_wind_diary.entity.TokenEntity;
import com.tiny_wind.tiny_wind_diary.entity.UserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl  {

//	private Logger logger = LoggerFactory.getLogger(this.getClass());

	// 注入Service依赖
	@Autowired
	private UserDao mDao;

	/**
	 * 查找对应account的用户信息,并返回用于对比.
	 * @param account
	 * @return
	 */
	public UserEntity search(String account) {
		UserEntity entity = mDao.searchByAccount(account);
		return entity;
	}

	public UserEntity searchByUserId(Integer userId) {
		UserEntity entity = mDao.searchByUserId(userId);
		return entity;
	}
	
	public void insertToken(TokenEntity token) {
		mDao.insertToken(token);
	}
	public void clearToken(Integer userId) {
		mDao.deleteToken(userId);
	}
	public String searchToken(Integer userId) {
		return mDao.searchToken(userId);
	}
}
